package cn.yuanyuan.filemodule.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 基础的文件上传
 */
@RestController
public class BaseFileUploadController {

    @PostMapping("/single-file-upload")
    public Object singleFileUpload(
            ServletRequest raw,
            HttpServletRequest request,
                                               MultipartFile file) {
        System.out.println(file.getSize());
        return null;
    }

    @PostMapping("/slice-file-upload")
    public Object sliceUploadFile(@RequestParam Map<String, Object> paramMap, MultipartFile file) {
        System.out.println(file.getSize());
        return null;
    }
}
